#include "elementload.h"
#include <QCoreApplication>

ElementLoad &ElementLoad::getInstance()
{
    static ElementLoad instance;
    return instance;
}

void ElementLoad::readBoxIni()
{
    QSettings settings(m_fileName, QSettings::IniFormat);
    settings.setIniCodec("UTF8");  // 设置编码方式  --->解析ini配置文件中的文字问题
    // 获取box分组下的信息
    settings.beginGroup("box");
    settings.allKeys();
    QString strIp = settings.value("ip").toString();
    int port = settings.value("port").toInt();
    settings.endGroup();



}

void ElementLoad::readGameIni()
{

}

void ElementLoad::readEnemyIni()
{

}

void ElementLoad::readPlayerIni()
{

}

void ElementLoad::readImageIni()
{

}

ElementLoad::ElementLoad()
{
    QString fileName;
    fileName = QCoreApplication::applicationDirPath();
    fileName += "/properties.ini";
    m_fileName = fileName;
}


const QHash<QString, QImage> &ElementLoad::imageMap() const
{
    return m_imageMap;
}

const QHash<QString, QStringList> &ElementLoad::playMap() const
{
    return m_playMap;
}

const QHash<QString, QStringList> &ElementLoad::enemyMap() const
{
    return m_enemyMap;
}

const QHash<QString, QStringList> &ElementLoad::boxMap() const
{
    return m_boxMap;
}

const QStringList &ElementLoad::gameList() const
{
    return m_gameList;
}

